/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.objects;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>This class represents the event handler which holds an optional list of filters and an optional command sequence.
 * It is a simple JavaBean (POJO) that provides getters and setters for all private attributes and performs no argument
 * validation in the setters.</p>
 *
 * <p><strong>Thread safety:</strong> This class is mutable and not thread safe.</p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
public class XREEventHandler {

    /**
     * <p>The list where each element is a hash that represents a single filter. Each filter's key is the name of the
     * XRE event's property on which to filter, and each filter's value is the value that will result in a successful
     * match.</p>
     *
     * <p>Can be any value, can contain any values.</p>
     *
     * <p>Has getter and setter.</p>
     */
    private List<Map<String, Object>> filter = new ArrayList<Map<String, Object>>();

    /**
     * <p>The command sequence to execute when the event is triggered. Providing a command sequence will result in this
     * event being handled client-side, and the event will not be dispatched to the host.</p>
     *
     * <p>Can be any value.</p>
     *
     * <p>Has getter and setter.</p>
     */
    private XRECommandSequence commandSequence;

    /**
     * <p>Creates new instance of {@link XREEventHandler} class.</p>
     */
    public XREEventHandler() {
        // empty constructor
    }

    /**
     * <p>Retrieves the list where each element is a hash that represents a single filter.</p>
     *
     * @return the list where each element is a hash that represents a single filter
     */
    public List<Map<String, Object>> getFilter() {
        return filter;
    }

    /**
     * <p>Sets the list where each element is a hash that represents a single filter.</p>
     *
     * @param filter the list where each element is a hash that represents a single filter
     */
    public void setFilter(List<Map<String, Object>> filter) {
        this.filter = filter;
    }

    /**
     * <p>Retrieves the command sequence to execute when the event is triggered.</p>
     *
     * @return the command sequence to execute when the event is triggered
     */
    public XRECommandSequence getCommandSequence() {
        return commandSequence;
    }

    /**
     * <p>Sets the command sequence to execute when the event is triggered.</p>
     *
     * @param commandSequence the command sequence to execute when the event is triggered
     */
    public void setCommandSequence(XRECommandSequence commandSequence) {
        this.commandSequence = commandSequence;
    }
}

